package com.s59.rbac.common;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionAdvice {

    @ExceptionHandler(AccessDeniedException.class)
    public R handler(){
        return R.err(403, "无权访问");
    }

    @ExceptionHandler(Exception.class)
    public R handler(Exception ex){
        return R.err(ex.getMessage());
    }
}
